← Back
Editing: index468.js
import{_ as e}from"./index94.js?v=1765440387";import{r as a,k as t,c as s,q as n,v as l,y as r,C as o,B as i,z as c,x as p,e as m,A as u,D as d}from"./base-lib.js?v=1765440387";import{_ as v}from"./index92.js?v=1765440387";import{o as h,L as f,b as _,q as y,K as g,ff as j,a7 as b,j2 as w,A as x,_ as k}from"./utils-lib.js?v=1765440387";import{u as q}from"./useStore3.js?v=1765440387";import{u as C}from"./column.js?v=1765440387";import{fQ as V,fR as P,fS as E}from"./site.js?v=1765440387";import{f as D}from"./validator.js?v=1765440387";const I=_(),{siteInfo:S}=q(),O=a(),A=a(!1),L=a([]),M=t({pyVersion:"",path:"",search:""}),T=a(!1),B=()=>{T.value=!0,A.value=!0},R=async e=>{try{const t=await V({project_name:S.value.name,force:T.value?1:0,search:e.search});if(T.value=!1,!1===t.data.status)return I.error(t.data.msg),{data:[],total:0};M.pyVersion=t.data.python_version,M.path=t.data.requirement_path,L.value=(a=t.data.pip_source,Object.entries(a).map((([e,a])=>({label:e,key:a,value:e}))));let s=t.data.pip_list;return""!==e.search&&(s=s.filter((a=>a.name.includes(e.search)))),{data:s,total:s.length}}catch(t){return{data:[],total:0}}var a},z=e=>{O.value=e||null,h({area:75,isAsync:!0,title:"安装第三方库",btn:"安装",component:()=>f((()=>import("./install-package.js?v=1765440387")),__vite__mapDeps([]),import.meta.url),compData:{row:e,path:M.path,project_name:S.value.name,pipSource:L.value,refreshEvent:()=>{}}})},U=async e=>{await y({title:"卸载第三方库",icon:"warning-filled",content:"是否卸载第三方库【".concat(e.name,"】?")});(await g({loading:"正在卸载,请稍后...",request:P({project_name:S.value.name,package_name:e.name,active:"uninstall"}),message:!0})).status&&(A.value=!0)},H=()=>{D({type:"file",path:M.path,change:e=>{(async e=>{(await g({loading:"正在修改,请稍后...",request:E({project_name:S.value.name,requirement_path:e}),message:!0})).status&&(A.value=!0)})(e)}})},K=a(),Q=t({type:"common",name:"",version:"",file:"",pip:""}),F=t({name:[{validator:(e,a,t)=>{"common"===Q.type?a?t():t(new Error("请输入名称")):t()}}],file:[{validator:(e,a,t)=>{"file"===Q.type?a?t():t(new Error("请选择记录文件")):t()}}]}),G=()=>{D({type:"file",path:Q.file,change:e=>{Q.file=e}})},J=async()=>{var e,a;Q.name=(null==(e=O.value)?void 0:e.name)||"",Q.file=M.path||"",Q.pip=(null==(a=L.value[0])?void 0:a.label)||""},N=async e=>{try{await K.value.validate();const a="file"===Q.type;let t={project_name:S.value.name,pip_source:Q.pip};t=a?{...t,requirement_path:Q.file}:{...t,package_name:Q.name,package_version:Q.version,active:"install"},h({title:"正在安装,请耐心等候...",area:52,component:()=>f((()=>import("./log2.js?v=1765440387")),__vite__mapDeps([]),import.meta.url),compData:{type:"createPythonProject",logPath:"/www/server/python_project//vhost/logs/pip_".concat(t.project_name,".log"),endMsg:"安装结束",failMsg:"环境准备失败",successMsg:"安装结束",isClear:!0,completeEvent:(e,a)=>{A.value=!0,a()}}}),e();const s=await P(t);I.request(s)}catch(a){}},W={class:"grid grid-cols-1 gap-y-[1rem]"},X={class:"flex flex-col leading-[2rem]"},Y={class:"flex items-center"},Z={class:"flex items-center"},$={class:"h-[45rem] mt-[2rem]"},ee=k(s({__name:"index",setup(a){const{siteInfo:t}=q(),{BtTable:s,BtSearch:h}=j({request:R,columns:[{label:"名称",prop:"name"},{label:"版本",prop:"version"},{label:"依赖记录文件中的版本",prop:"requirement"},C([{onClick:z,title:"安装",render:e=>{let a="--"===e.version;return a=a&&!e.requirement.includes("git")&&!e.requirement.includes("file"),a?m("span",{class:"text-primary cursor-pointer hover:text-[#1d9534]",onClick:()=>z(e)},[i("安装")]):""}},{onClick:U,isHide:e=>"--"===e.version,title:"卸载"}])],extension:[b(A),w()]});return(a,f)=>{const _=v,y=d,g=e;return n(),l("div",null,[r("div",W,[o(' <div class="mr-[1rem]"></div>\n\t\t\t<bt-select\n\t\t\t\tv-model="envData.pyVersion"\n\t\t\t\t:options="versionOptions"\n\t\t\t\tclass="w-[14rem]"\n\t\t\t\t:change="eventSelect"></bt-select> '),o(' <el-descriptions>\n\t\t\t\t<el-descriptions-item label="Python版本">{{ envData.pyVersion }}</el-descriptions-item>\n\t\t\t</el-descriptions> '),r("div",null,[f[3]||(f[3]=i(" Python版本 ")),r("span",null,c(p(M).pyVersion),1)]),r("div",X,[f[5]||(f[5]=r("span",null,"命令行使用项目中的环境:",-1)),f[6]||(f[6]=r("span",null,[i("命令行可使用 "),r("code",null,"source py-project-env [项目名称]"),i(" 进入该项目虚拟环境,退出时使用"),r("code",null,"deactivate")],-1)),r("span",Y,[f[4]||(f[4]=i(" 示例:")),r("code",null,"source py-project-env "+c(p(t).name),1),r("i",{class:"svgtofont-el-document-copy cursor-pointer text-[#333] text-[1.5rem] copy ml-[4px]",title:"复制启动命令",onClick:f[0]||(f[0]=()=>p(x)({value:"source py-project-env ".concat(p(t).name)}))})]),f[7]||(f[7]=r("span",null,"若提示没有py-project-env文件,可尝试关闭系统加固并重启面板,然后进入Python项目页面此,时会自动设置该文件",-1))]),r("div",Z,[f[8]||(f[8]=r("span",{class:"mr-[1rem] whitespace-nowrap"},"依赖记录文件",-1)),m(_,{modelValue:p(M).path,"onUpdate:modelValue":f[1]||(f[1]=e=>p(M).path=e),icon:"el-folder-opened",onIconClick:p(H),width:"40rem"},null,8,["modelValue","onIconClick"])])]),o(' <div class="mt-[2rem] h-[15rem] border"></div> '),r("div",$,[m(g,null,{"header-left":u((()=>[m(y,{type:"primary",onClick:f[2]||(f[2]=e=>p(z)())},{default:u((()=>f[9]||(f[9]=[i("安装")]))),_:1})])),"header-right":u((()=>[m(p(h),{width:"20rem",placeholder:"搜索第三方库"}),m(y,{type:"default",class:"!ml-[1rem]",onClick:p(B)},{default:u((()=>f[10]||(f[10]=[i("强制刷新")]))),_:1},8,["onClick"])])),content:u((()=>[m(p(s),{"max-height":480})])),_:1})]),o(' <bt-help :options="helpList" list-style="none" class="ml-[20px] mt-[20px]"></bt-help> ')])}}}),[["__scopeId","data-v-f48d81ca"],["__file","/Users/chudong/project/linux-10/src/views/site/views/python-model/env-manage/index.vue"]]),ae=Object.freeze(Object.defineProperty({__proto__:null,default:ee},Symbol.toStringTag,{value:"Module"}));export{G as a,K as b,ae as c,J as g,Q as i,N as o,L as p,F as r}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel